// pages/order/order.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

    selectedIndex: 0,
    showMask: false
  },
  //待消费
  waiting:function(){
    this.setData({
      selectedIndex: 0
    })
  },
  //服务中
  servicing:function(){
    this.setData({
      selectedIndex: 1
    })
  },
  //已取消
  canceled:function(){
    this.setData({
      selectedIndex: 2
    })
  },
  //已完成
  finished:function(){
    this.setData({
      selectedIndex: 3
    })
  },
  //取消排号
  cancelOrder: function (res) {
    var that = this
    var animation = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease-out'
    })
    that.animation = animation
    animation.translateY(-412).opacity(0.5).step()

    that.setData({
      maskAnim: animation.export(),
      showMask: true
    })
    setTimeout(function () {
      animation.translateY(0).opacity(1).step()
      that.setData({
        maskAnim: animation.export()
      })
    }, 400)
  },
  //再等一会儿
  waitToSure: function (res) {

    var that = this
    var animation = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease'
    })
    that.animation = animation
    animation.translateY(-412).opacity(0.5).step()

    that.setData({
      maskAnim: animation.export(),
    })
    setTimeout(function () {
      animation.translateY(0).opacity(1).step()
      that.setData({
        maskAnim: animation.export(),
        showMask: false
      })
    }, 400)
  },
  //确认放弃排号
  cancelSure:function(res){
      // 取消排号，待消费订单撤销
    var that = this
    var animation = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease'
    })
    that.animation = animation
    animation.translateY(-412).opacity(0.5).step()

    that.setData({
      maskAnim: animation.export(),
    })
    setTimeout(function () {
      animation.translateY(0).opacity(1).step()
      that.setData({
        maskAnim: animation.export(),
        showMask: false,
        selectedIndex: 2
      })
    }, 400)
  },
  //评价发型师
  masterPj:function(){
   wx.navigateTo({
     url: '/pages/pingjia/pingjia',
   })
  },
  forbiddenTouch: function (res) {

  },
  checkOrderInfo:function(){
    wx.navigateTo({
      url: '/pages/orderInfo/orderInfo',
    })
  },
  sureToPay:function(){
    wx.navigateTo({
      url: '/pages/readyToPay/readyToPay',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
   this.setData({
     selectedIndex: 0
   })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})